AI Lessons
Lesson 24: Attention - How AI decides what is important

Purpose: How the attention mechanism helps AI focus on the most relevant parts of the input.

No. of Classes

1 - (Time : 1 hour 30 minutes, Laptops/desktops : 10, Students strength : 15 to 20).

Materials Required

Laptop / Desktop with Internet connections / Wi-Fi.

Prior knowledge
  • Students know that text and images are broken into smaller tokens or feature vectors for AI.
  • Students understand that neural networks learn patterns and assign weights to connections.
Exercises

Exercise (1)



  • Identify the most important words in a sentence that describe an image and learn how the attention mechanism helps AI focus on the most relevant information.

Exercise (2)



Solutions



Teacher's Instruction:
  1. Explain that human attention naturally skips background details to focus on key elements, and AI uses the attention mechanism to do the same.
  2. Guide students through Exercise 1 by asking them to highlight key words in a descriptive sentence before revealing how an AI calculates attention weights for each word.
  3. Discuss how attention allows AI models to process entire long sentences at once rather than reading rigidly word-by-word.
  4. Points to Ponder:
    • When looking at a photo of a dog in a park, which pixels should receive high attention from an AI trying to identify the dog?
    • How is an AI's mathematical attention different from human attention when listening to a teacher in a noisy classroom?